<template>
	<div>
		<uni-list>
			<uni-list-item title="货物名称" :rightText="formData.goodsName" />
			<uni-list-item title="生产企业" :rightText="formData.produceCompany" />
			<uni-list-item title="生产地" :rightText="formData.produceDistrictName+''+formData.produceAddress" />
			<uni-list-item title="货物类型" :rightText="goodsType_[formData.goodsType]" />
			<uni-list-item title="包装" :rightText="packingType_[formData.packingType]" />
			<uni-list-item title="货号" :rightText="formData.goodCode" />
			<uni-list-item title="货物上市时间" :rightText="formData.marketTime" />
			<uni-list-item title="物品描述" :rightText="formData.goodsDesc" />
			<uni-list-item title="备注" :rightText="formData.remark" />
		</uni-list>
		<view style="height: 50px;"></view>
	</div>
</template>

<script>
	import {
		getSourceDetails
	} from '@/api/system/source.js'
	import {getDicts} from '@/api/system/dict.js'
	export default {
		data() {
			return {
				formData:{}, //详情
				//下拉框 ->货物类型
				goodsType_: [],
				//下拉框 ->包装类型
				packingType_: [],
				goodId:'',
			}
		},
		onLoad(e) {
			if (e.goodId) {
				uni.showLoading({
					title: '正在加载',
				})
				this.goodId = e.goodId
				//获取货源详情
				getSourceDetails(e.goodId).then(res => {
					uni.hideLoading()
					if (res.code == '200') {
						this.formData = res.data		
					} else {
						uni.showToast({
							icon: 'none',
							title: res.msg
						})
					}
				})
			}
		},
		created() {
			//获取货物类型下拉框
			getDicts('goods_type').then(res=>{
				res.data.forEach(item=>{
					this.goodsType_[item.dictValue]=item.dictLabel
				})
			})
			//获取包装类型下拉框
			getDicts('packing_type').then(res=>{
				res.data.forEach(item=>{
					this.packingType_[item.dictValue]=item.dictLabel
				})
			})
		},
		methods: {
			
		},
	}
</script>

<style scoped>
::v-deep .uni-list-item__extra{
	flex: 1;
}
</style>